package com.zpark.controller;

import com.zpark.pojo.Ranking;
import com.zpark.service.IRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Title: RankingController
 * @Author Charles
 * @Package controller
 * @Date 2022/10/11 10:54
 */
@RestController
public class RankingController {
    @Autowired
    private IRankingService rankingService;

    @RequestMapping("/all")
    public List<Ranking> all(){
        return rankingService.findAll();
    }
    @RequestMapping("/del/{id}")
    public String remove(@PathVariable Integer id){

        Integer row =rankingService.remove(id);
        return "删除数据"+row;
    }
    @RequestMapping("/update")
    public String change(Ranking ranking){
        Integer row =rankingService.change(ranking);
        return "修改数据"+row;
    }
    @RequestMapping("/add")
    public String add(Ranking ranking){
        Integer row =rankingService.add(ranking);
        return "添加数据"+row;

    }
}

